package com.zzzm.hospital.ui.activity;

import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;

import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.zzzm.hospital.R;
import com.zzzm.hospital.customerview.AgreementDialog;
import com.zzzm.hospital.customerview.AppointmentView;

public class AppointmentActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_appoiment);

        initView();
    }

    private void initView() {

        AppointmentView appointmentBtn = findViewById(R.id.appointment_btn);

        appointmentBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //显示对话框
                showAlertDialog();

                //跳转到科面室列表页
                jumpDepartmentList();
            }
        });
    }

    //显示对话框
    private void showAlertDialog() {
        AgreementDialog dialog = new AgreementDialog(AppointmentActivity.this);
        dialog.setListener(dialog::dismiss);
        dialog.show();
    }

    //跳转到科面室列表页
    private void jumpDepartmentList() {
        Intent intent = new Intent(AppointmentActivity.this, DepartmentActivity.class);
        startActivity(intent);
    }
}